from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.common.touch_action import TouchAction

caps = {}  # 存储设备及被测软件配置
caps["platformName"] = "Android"
caps["platformVersion"] = "6.0.1"
caps["deviceName"] = "127.0.0.1:7555"
caps["appPackage"] = "com.netease.cloudmusic"
caps["appActivity"] = ".activity.LoadingActivity"
caps["noReset"] = "true"
# 使用appium 启动应用程序
driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) # 连接服务器
driver.implicitly_wait(10)


touch_action = TouchAction(driver)
# touch_action.move_to().perform() # 触摸操作

# driver.find_element_by_windows_uiautomation()

# el1 = driver.find_element_by_accessibility_id("请输入QQ号码或手机或邮箱")
# el1.clear()
# el1.click()
# el1.send_keys("760731349")
# el2 = driver.find_element_by_accessibility_id("密码 安全")
# el2.click()
# el2.send_keys("jjq323209")
# el3 = driver.find_element_by_accessibility_id("登录")
# el3.click()
# el4 = driver.find_element_by_accessibility_id("帐户及设置")
# el4.click()
# el5 = driver.find_element_by_xpath("//android.widget.Button[@content-desc=\"设置\"]/android.widget.FrameLayout/android.widget.TextView")
# el5.click()
# el6 = driver.find_element_by_id("com.tencent.mobileqq:id/account_switch")
# el6.click()
# el7 = driver.find_element_by_accessibility_id("退出当前帐号按钮")
# el7.click()
# el8 = driver.find_element_by_id("com.tencent.mobileqq:id/dialogRightBtn")
# el8.click()


